package com.cloud.api.myenum;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @author 杨斌
 * 2024-07-9/7/2024
 */
public enum ReleaseTimeEnum implements IEnum<Integer> {
    NOW(0, "刚刚"),
    TWO_HOURS_AGO(1, "2小时内"),
    LATELY(2, "不久前"),

    RELEASE_DATE(3,"");


    ReleaseTimeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    private Integer value;
    @JsonValue
    @EnumValue
    private String desc;

    @Override
    public Integer getValue() {
        return this.value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static ReleaseTimeEnum getReleaseTimeEnum(Integer value) {
        for (ReleaseTimeEnum releaseTimeEnum : ReleaseTimeEnum.values()) {
            if (releaseTimeEnum.getValue().equals(value)) {
                return releaseTimeEnum;
            }
        }
        return null;
    }
}